﻿Imports MordecaiHunter.CommonCodeLibrary.Tools

Namespace Tools.NDS
    Friend Class clsColor
        Private _a As Integer
        Private _r As Integer
        Private _g As Integer
        Private _b As Integer

        Private _color As Drawing.Color

        Public Sub New()
            _a = 0
            _r = 0
            _g = 0
            _b = 0
        End Sub
        Public Sub New(ByVal data() As Byte)
            Dim value As Integer
            value = clsByteReaderFunctions.GetDataPartToInteger(data, 0, 2)

            _a = 255

            _r = (value Mod 32) * 8
            value = value \ 32
            _g = (value Mod 32) * 8
            value = value \ 32
            _b = (value Mod 32) * 8
        End Sub

        Public ReadOnly Property A As Integer
            Get
                Return _a
            End Get
        End Property
        Public ReadOnly Property R As Integer
            Get
                Return _r
            End Get
        End Property
        Public ReadOnly Property G As Integer
            Get
                Return _g
            End Get
        End Property
        Public ReadOnly Property B As Integer
            Get
                Return _b
            End Get
        End Property

        Public ReadOnly Property Color As Drawing.Color
            Get
                Return Drawing.Color.FromArgb(_a, _r, _g, _b)
            End Get
        End Property
    End Class
End Namespace